home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / make / icmake-6.000 / icmake-6 / icmake / rss / getoptin.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-08  |  1.2 KB  |  56 lines

  1. /*                              G E T O P T I N . C
  2.     % 1 name
  3. \functoc {getoptindex}
  4.     % 2 declaration
  5. {int \fname (\params\ )}
  6.     % 3 arguments
  7. {}
  8.     % 4 return value
  9. {The index in the \Var{argv} command line argument vector where the last option
  10. was found}
  11.     % 5 functions used
  12. {}
  13.     % 6 see also
  14. {getoptval, setoptchars, getopt}
  15.     % 7 source file
  16. {getopt.c}
  17.     % 8 description
  18. {The function returns the index in the \Var{argv} vector where the last
  19. argument was found after a call of \Function{getopt}. The returnvalue of the
  20. function is undefined before the first call of function \Function{getopt}.
  21.  
  22. Note that after a call to \Function{getopt} the element
  23. \Var{argv[getoptindex()]} does not point to the optionstring, but to the
  24. command line entry which originally following the optionstring, as
  25. \Function{getopt} removes the optionstring from the \Var{argv} array.
  26. }
  27.     % 9 example
  28. {}
  29. \footnotesize
  30. \begin{verbatim}
  31.  
  32. #include <icce.h>
  33.  
  34. void main(int argc, char **argv)
  35. {
  36.     while ((c = getopt(&argc, argv)) != -1)
  37.         printf("Command line option was at index %d\n", getoptindex());
  38. }
  39.  
  40. \end{verbatim}
  41. \normalsize
  42. */
  43. #ifndef MSDOS
  44.  
  45. #include "icrss.h"
  46.  
  47. extern int
  48.     near icce_next_option;
  49.  
  50. int ic_getoptindex()
  51. {
  52.     return (icce_next_option);
  53. }
  54.  
  55. #endif
  56.